//
//  JgAdsEventReporter.h
//  JgAdsSDK
//
//  Created by Erik on 2021/9/14.
//

#import <Foundation/Foundation.h>
#import <JgAdsSDK/JgAdsCommonDefine.h>

NS_ASSUME_NONNULL_BEGIN

typedef NSString * JgAdsSDKReportStatus NS_EXTENSIBLE_STRING_ENUM;

FOUNDATION_EXPORT JgAdsSDKReportStatus _Nonnull const JgAdsSDKReportStatusRequest;

FOUNDATION_EXPORT JgAdsSDKReportStatus _Nonnull const JgAdsSDKReportStatusSuccess;

FOUNDATION_EXPORT JgAdsSDKReportStatus _Nonnull const JgAdsSDKReportStatusWinNotice;

FOUNDATION_EXPORT JgAdsSDKReportStatus _Nonnull const JgAdsSDKReportStatusWinFail;

FOUNDATION_EXPORT JgAdsSDKReportStatus _Nonnull const JgAdsSDKReportStatusDisplay;

FOUNDATION_EXPORT JgAdsSDKReportStatus _Nonnull const JgAdsSDKReportStatusClick;

FOUNDATION_EXPORT JgAdsSDKReportStatus _Nonnull const JgAdsSDKReportStatusClose;

FOUNDATION_EXPORT JgAdsSDKReportStatus _Nonnull const JgAdsSDKReportStatusFailed;

FOUNDATION_EXPORT JgAdsSDKReportStatus _Nonnull const JgAdsSDKReportStatusRewarded;

@interface JgAdsBidLoss : NSObject
// 竟败原因
@property (nonatomic, assign) JgAdsBiddingLossReason reason;
// 竟胜方价格
@property (nonatomic, assign) NSInteger otherBidPrice;

- (instancetype)initWithReason:(JgAdsBiddingLossReason)reason winnerPrice:(NSInteger)winnerPrice;

@end

@interface JgAdsReportMark : NSObject

@property (nonatomic, assign) BOOL requestReported;
@property (nonatomic, assign) BOOL successReported;
@property (nonatomic, assign) BOOL winNoticeReported;
@property (nonatomic, assign) BOOL winFailReported;
@property (nonatomic, assign) BOOL failureReported;
@property (nonatomic, assign) BOOL displayReported;
@property (nonatomic, assign) BOOL clickReported;
@property (nonatomic, assign) BOOL closeReported;
@property (nonatomic, assign) BOOL rewardReported;

- (void)refreshStatus;
@end

@interface JgAdsEventReporter : NSObject


- (instancetype)initWithAdSourceId:(NSString *)adSourceId;
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)new NS_UNAVAILABLE;

/// 广告位id
@property (nonatomic, copy) NSString *adPositionId;

// 竟败原因对象
@property (nonatomic, strong) JgAdsBidLoss *winFail;

/**
 广告位上报
 */

- (void)sendAdPositionRequestReportWithPosId:(NSString *)posId count:(NSInteger)number;

/**
 广告源上报
 */

- (void)sendRequestWithMark:(JgAdsReportMark *)mark;

- (void)sendRequestReport;

- (void)sendRequestReportWithCount:(NSInteger)count;

- (void)sendSucceedWithMark:(JgAdsReportMark *)mark;

- (void)sendSucceedReport;

- (void)sendSucceedReportWithCount:(NSInteger)count;

- (void)sendWinNoticeReport:(JgAdsReportMark *)mark;

- (void)sendWinNoticeReport;

- (void)sendWinFailReport:(JgAdsReportMark *)mark bidLossReason:(JgAdsBiddingLossReason)reason winnerPrice:(NSInteger)winnerPrice;

- (void)sendFailWithMark:(JgAdsReportMark *)mark;

- (void)sendFailReport;

- (void)sendFailReportWithCount:(NSInteger)count;

- (void)sendDisplayWithMark:(JgAdsReportMark *)mark;

- (void)sendDisplayReport;

- (void)sendDisplayReportWithCount:(NSInteger)count;

- (void)sendClickWithMark:(JgAdsReportMark *)mark;

- (void)sendClickReport;


- (void)sendRewardWithMark:(JgAdsReportMark *)mark;

- (void)sendRewardReport;

- (void)sendCloseWithMark:(JgAdsReportMark *)mark;

- (void)sendCloseReport;

#pragma mark - Bidding Report

/**
 *  竞胜之后调用, 需要在展示广告之前调用
 */
- (void)sendWinNotification;

/**
 *  竞败之后调用
 *  @param price - 竞胜价格 (单位: 元)
 *  @param reason - JgAds广告竞败原因
 */
- (void)sendLossNotificationWithWinnerPrice:(double)price lossReason:(JgAdsBiddingLossReason)reason;


@end

NS_ASSUME_NONNULL_END
